import { ApiProperty } from '@nestjs/swagger'
import {
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  MaxLength
} from 'class-validator'

export class CreateJobDto {
  @ApiProperty({ example: '测试', description: '职位名称' })
  @IsNotEmpty({ message: '职位名称不能为空' })
  @IsString({ message: '职位名称必须为字符串' })
  @MaxLength(10, { message: '职位名称不能超过10个字符' })
  name: string
  @ApiProperty({ example: '测试职位描述', description: '职位描述' })
  @IsOptional()
  @IsString({ message: '职位描述必须为字符串' })
  @MaxLength(50, { message: '职位描述不能超过50个字符' })
  desc?: string
  @ApiProperty({ example: '1', description: '部门id' })
  @IsNotEmpty({ message: '部门id不能为空' })
  @IsNumber({}, { message: '部门id必须为数字' })
  departmentId: number
  @ApiProperty({ example: '1', description: '账套id' })
  @IsNotEmpty({ message: '账套id不能为空' })
  @IsNumber({}, { message: '账套id必须为数字' })
  accountId: number
}
